home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / nihcl-30.lha / nihcl-3.0 / test / orderedcltn.c < prev    next >
C/C++ Source or Header  |  1990-05-19  |  3KB  |  84 lines

  1. /* Test class OrderedCltn
  2.  
  3.     THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
  4.     "UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
  5.     AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
  6.     CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
  7.     PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
  8.     RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
  9.  
  10. Author:
  11.     K. E. Gorlen
  12.     Bg. 12A, Rm. 2033
  13.     Computer Systems Laboratory
  14.     Division of Computer Research and Technology
  15.     National Institutes of Health
  16.     Bethesda, Maryland 20892
  17.     Phone: (301) 496-1111
  18.     uucp: uunet!nih-csl!kgorlen
  19.     Internet:kgorlen@alw.nih.gov
  20.  
  21. Function:
  22.     
  23. Modification History:
  24.     
  25. $Log:    orderedcltn.c,v $
  26.  * Revision 3.0  90/05/20  00:29:33  kgorlen
  27.  * Release for 1st edition.
  28.  * 
  29. */
  30. static char rcsid[] = "$Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/test/RCS/orderedcltn.c,v 3.0 90/05/20 00:29:33 kgorlen Rel $";
  31.  
  32. #include "Point.h"
  33. #include "OrderedCltn.h"
  34. #include "Set.h"
  35.  
  36. main()
  37. {
  38.     cout << "\nTest class OrderedCltn" << endl;
  39.     Point A(1,1);
  40.     Point B(1,2);
  41.     Point C(1,3);
  42.     Point D(1,3);
  43.     OrderedCltn b(16);
  44.     OrderedCltn c;
  45.     b.add(A);
  46.     b.add(B);
  47.     b.add(C);
  48.     b.add(D);
  49.     cout << "b = " << b << endl;
  50.     cout << "b.first(): " << *(b.first()) << endl;
  51.     cout << "b.last(): " << *(b.last()) << endl;
  52.     b.addAfter(Point(1,2),Point(1,21));
  53.     b.addBefore(Point(1,2),Point(1,19));
  54.     cout << "b = " << b << endl;
  55.     cout << "b.after(Point(1,2)): " << *(b.after(Point(1,2))) << endl;
  56.     cout << "b.before(Point(1,2)): " << *(b.before(Point(1,2))) << endl;
  57.     c = b;
  58.     b.reSize(30);
  59.     cout << "b.includes(C): " << b.includes(C) << endl;
  60.     cout << "c == b: " << (c==b) << endl;
  61.     cout << "b.compare(c): " << b.compare(c) << endl;
  62.     c.removeAll();
  63.     cout << "c = " << c << endl;
  64.     c = b;
  65.     b.addAllLast(c);
  66.     cout << "b = " << b << endl;
  67.     cout << "b.compare(c): " << b.compare(c) << endl;
  68.     cout << "c.compare(b): " << c.compare(b) << endl;
  69.     b.remove(C);
  70.     cout << "b.includes(C): " << b.includes(C) << endl;
  71.     cout << "b = " << b << endl;
  72.     cout << "c == b: " << (c==b) << endl;
  73.     cout << "b.compare(c): " << b.compare(c) << endl;
  74.     cout << "c&b:" << (c&b) << endl;
  75.     cout << "b.indexOfSubCollection(c): " << b.indexOfSubCollection(c,1) << endl;
  76.     cout << "c = " << c << endl;
  77.     b.replaceFrom(1,3,c);
  78.     cout << "b.replaceFrom(1,3,c): " << b << endl;
  79.     b.sort();
  80.     cout << "b.sort(): " << b << endl;
  81.     cout << "b.asSet(): " << (b.asSet()) << endl;
  82.     cout << "c.removeId(D)->isSame(D): " << c.removeId(D)->isSame(D) << endl;
  83. }
  84.